package chuangya.com.anmi.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.gson.internal.bind.DateTypeAdapter;

import java.util.List;

import RecycleViewUtil.SunStartBaseAdapter;
import RecycleViewUtil.ViewHolder;
import chuangya.com.anmi.R;
import chuangya.com.anmi.databean.MainBottomData;

/**
 * Created by Sun.Star on 2017/6/23.
 */

public class MainBottomAdapter extends SunStartBaseAdapter{
    public MainBottomAdapter(Context context, List<?> list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return R.layout.main_bottom_item;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        MainBottomData data = (MainBottomData) list.get(position);
        ImageView img = holder.getImageView(R.id.main_bottom_item_img);
        TextView tv = holder.getTextView(R.id.main_bottom_item_text);
        if(data.isCheck()){
            img.setImageResource(data.getCheckImgId());
            tv.setTextColor(context.getResources().getColor(R.color.colorAccent));
        }else{
            img.setImageResource(data.getNoCheckId());
            tv.setTextColor(context.getResources().getColor(R.color.textGray));
        }
        tv.setText(data.getText());
    }
}
